{extend name="index/index"/}

{block name="body"}
<script type="text/javascript">
    $(document).ready(function(){
        $('form input:button').click(function () {
            if(!confirm('确定要解除绑定，继续吗？')){return false};
            $.post('?s=Wechat/authdel','',function(data){
                if(data.ret == 1){
                    alert(data.msg);
                    window.location.reload();
                }else{
                    alert(data.msg);
                    return false;
                }
            })
        });
    });
    $(document).ready(common_obj.form_submit);
    
</script>

<header class="tab-head">
    <ul class="nav nav-tabs">
        <li class="active">
            <a href="{:url('Wechat/auth')}">微信授权配置</a>
        </li>

        <li class="">
            <a href="{:url('Wechat/pay')}">微信支付配置</a>
        </li>
    </ul>
</header>

<section class="wrapper" style="margin-top:0">
    <div class="row">
        <div class="col-lg-12">
            <section class="panel">
                <div class="panel-body">
                    <div class="form">
                        <form class="cmxform form-horizontal tasi-form" id="data-form">

                            <div class="form-group">
                                <label class="control-label col-lg-2">服务器地址(URL)</label>
                                <div class="col-lg-10">
                                    <p class="form-control-static">{$url}</p>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-2">令牌(Token)</label>
                                <div class="col-lg-10">
                                    <p class="form-control-static">microlife</p>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-2">小程序名称</label>
                                <div class="col-lg-10">
                                    <input class="form-control" type="text" name="name" value="{$data.name}" required="required"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-2">原始ID</label>
                                <div class="col-lg-10">
                                    <input class="form-control" type="text" name="weixinid" value="{$data.weixinid}" required="required"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-2">开发者ID(AppID)</label>
                                <div class="col-lg-10">
                                    <input class="form-control" type="text" name="appid" value="{$data.appid}" required="required"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-2">开发者密码(AppSecret)</label>
                                <div class="col-lg-10">
                                    <input class="form-control" type="text" name="appsecret" value="{$data.appsecret}" required="required"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <input class="btn btn-danger" type="submit" value="提交保存">
                                    <input class="btn btn-warning" type="button" value="解除绑定">
                                </div>
                            </div>

                            <input type="hidden" name="id" value="{$data.id}">
                            <input type="hidden" name="token" value="microlife">
                        </form>
                        <input type="hidden" id="do_action" value="{:url('Wechat/auth')}"/>
                    </div>
                </div>
            </section>
        </div>
    </div>
</section>
{/block}